@extends('admin.layout')
@section('content')

  
    

<!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
       
        <div id="breadcrumbs" class="breadcrumbs">
            <ol class="breadcrumb">
            <li><a href="javascript:void();"><i class="fa fa-home"></i>&nbsp;&nbsp;后台首页</a></li>
                    
                    <li><a href="javascript:void();">权限管理</a></li>    
                    <li><a href="javascript:void();">管理员列表</a></li>          
            </ol>
        </div>

            @if(session('info'))
              <div class="row">
                <div class="col-xs-6 col-xs-offset-3">
                  <div id="showHidden" class="alert alert-success alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <h4>  <i class="icon fa fa-check"></i> {{ session('info') }} </h4>
                    
                  </div>
                </div>
              </div>
            @endif


        <section class="content">
       <div class="row">
            <div class="col-xs-12">
                <div class="box">
                 <div class="box-header">
                    <nav class="navbar navbar-default">      
                        <div class="collapse navbar-collapse">
                          <form method="post" action="{{ asset('admin/admin/index') }}" class="navbar-form form-inline">
                            <div class="form-group">
                                <input type="text" placeholder="搜索" class="form-control" name="keywords">
                            </div>
                            <button class="btn btn-default" type="submit">提交</button>
                            <div class="form-group pull-right">
                                <a class="btn btn-primary pull-right" href="{{ asset('/admin/admin/add') }}"><i class="fa fa-plus"></i>添加管理员</a>
                            </div>                
                          </form>        
                        </div>
                    </nav>  
                 </div>              
                 <div class="box-body">                
                    <div class="row">
                    <div class="col-sm-12">
                      <table class="table table-bordered table-striped dataTable" id="list-table">
                         <thead>
                           <tr align="center" role="row">
                               <th>ID</th>
                               <th>用户头像</th>
                               <th>用户名</th>
                               <th>所属角色</th>
                               <th>Email地址</th>
                               <th>创建时间</th>
                               <th>操作</th>
                           </tr>
                         </thead>
                        <tbody>

                        @foreach($data as $user)
                          <tr align="center" role="row">
                             <td>{{ $user -> id}}</td>
                             <td><img width="50" height="50" src="{{ $user -> img}}"></td>
                             <td>{{ $user -> username}}</td>
                             <td>
                              
                              @if($user -> prerogative == 0)

                                普通管理员
                              @else if($user -> prerogative == 1)

                                超级管理员

                              @endif
                             </td>
                             <td>{{ $user -> email}}</td>
                             <td>{{ $user -> created_at}}</td>
                            
                             <td>
                                <a href="{{ url('/admin/admin/edit/{{ $user -> id}}" class="btn btn-primary"><i class="fa fa-pencil"></i></a>
                                <a href="{{ url('/admin/admin/delete/{{ $user -> id}}" class="btn btn-primary"><i class="fa fa-trash-o"></i></a>
                                <a href="{{ url('/admin/admin/delete/{{ $user -> id}}" class="btn btn-danger"><i class="fa fa-trash-o"></i></a>
                            </td>
                           </tr>  
                        @endforeach                       
                         </tbody>
                       </table>  
                   </div>
              </div>
             </div>
            </div>
        </div>
       </div>
   </section>
    </div><!-- /.content-wrapper -->

    <script type="text/javascript">
      
      window.onload = function()
      {

            //自动清楚提示框
            setTimeout("$('#showHidden').hide( )",3000); 
      }
    </script>

@endsection